﻿using System.Threading;
using Core.Debug;
using Core.Model;
using SharpDX.Direct3D10;

namespace SharpDX.Game.Debugger
{
    public class SharpDxWorldDebugger:WorldDebugger
    {
        private Device Device;

        public SharpDxWorldDebugger(Device device)
        {
            Device = device;
        }

        private bool IsWireFrame;

        protected override void OnFillModeChanged()
        {
            IsWireFrame = !IsWireFrame;

            RasterizerStateDescription rsd = new RasterizerStateDescription();

            rsd.FillMode = IsWireFrame ? FillMode.Wireframe : FillMode.Solid;
            rsd.CullMode = CullMode.Back;
            rsd.IsMultisampleEnabled = true;
            rsd.IsAntialiasedLineEnabled = false;
            rsd.IsDepthClipEnabled = false;
            rsd.IsScissorEnabled = false;

            Device.Rasterizer.State = new RasterizerState(Device, rsd);

            Thread.Sleep(300);
        }
    }
}
